package com.globallogic.javatrainings.sergiiivanov.model;

import java.io.Serializable;

import com.globallogic.javatrainings.sergiiivanov.resources.Messages;

/**
 * Constants and system wide variables
 * 
 * @author Sergey
 * 
 */
public class Const implements Serializable {

    /**
     * Enum that identifies available disciplines<br>
     * <b>Values:</b>C, C++, Java6, Java7, Math, Phys
     * <table border=1>
     * <th colspan=2 align=center>Methods</th>
     * <tr>
     * <td>{@link #getRepresentation()}</td>
     * <td>Returns string representation of the discipline. <br>
     * See {@link Messages}.DISCIPLINE_... constants</td>
     * </tr>
     * <tr>
     * <td>{@link #getNamesList()}</td>
     * <td>Returns String[] of representations.</td>
     * </tr>
     * </table>
     * 
     * @author Sergey
     * 
     */
    public static enum Discipline {
        /**
         * C programming language
         */
        C(Messages.DISCIPLINE_C),
        /**
         * C++ programming language
         */
        Cpp(Messages.DISCIPLINE_CPP),
        /**
         * Java programming language (JDK1.6)
         */
        Java6(Messages.DISCIPLINE_JAVA_6),
        /**
         * Java programming language (JDK1.7)
         */
        Java7(Messages.DISCIPLINE_JAVA_7),
        /**
         * Mathematics
         */
        Math(Messages.DISCIPLINE_MATHEMATICS),
        /**
         * Physics
         */
        Phys(Messages.DISCIPLINE_PHYSICS);
        /**
         * Returns {@link #values()} as String[] of {@link #getRepresentation()}
         * 
         * @see #getRepresentation()
         * @see #values()
         * @return names as String[]
         */
        public static String[] getNamesList() {
            Discipline[] vals = values();
            String[] res = new String[vals.length];
            for (int i = 0; i < vals.length; i++) {
                res[i] = vals[i].getRepresentation();
            }
            return res;
        }

        private final String representation;

        Discipline(String shownAs) {
            this.representation = shownAs;
        }

        /**
         * @return string representation of the discipline. See {@link Messages}
         *         .DISCIPLINE_... constants
         */

        public String getRepresentation() {
            return this.representation;
        }
    }

    private static final long serialVersionUID = 1L;
    /**
     * Empty line of String == ""<br>
     * used in comparisons for empty value of String variables<br>
     * example:<br>
     * <code>
     * String s = getSomeString();<br>
     * if(!Const.STRING_EMPTY.equals(s)){ doMyWork(); }
     * </code>
     */
    public static final String STRING_EMPTY = "";
    /**
     * String that means positive answer. Usage example: BasicController.yes()
     */
    public static final String YES_YES = "yes";
    /**
     * String that means positive answer. Usage example: BasicController.yes()
     */

    public static final String YES_Y = "y";
    /**
     * Minimal possible score that could be set for student in
     * Student.addScore(Course, Lecture, int, String)
     */
    public static final int MIN_SCORE = 0;
    /**
     * Maximum possible score that could be set for student in
     * Student.addScore(Course, Lecture, int, String)
     */
    public static final int MAX_SCORE = 100;
}
